<%@ Page Language="VB" MasterPageFile="~/MasterPageExpandable.master" AutoEventWireup="false" CodeFile="SpendingPlanView.aspx.vb" Inherits="Budget_SpendingPlanView" title="View Spending Plan" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="InputControls" Namespace="InputControls" TagPrefix="cc2" %>

<%@ Register Src="~/Budget/BudgetSubNav.ascx" TagName="SubNavPlaceHolder" TagPrefix="uc1" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

 <%@ Register src="../AJAX/PopupMessage.ascx" tagname="PopupMessage" tagprefix="uc2" %>

 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

     <script language="javascript" type="text/javascript">
function setEnabled(dropdownId,buttonId)
{
   if(document.getElementById(dropdownId).selectedIndex>0)
         document.getElementById(buttonId).disabled=false;
   else
         document.getElementById(buttonId).disabled=true;
}

function openCommentsWindow(id)
{
 mywindow = window.open ("../Case/ViewComments.aspx?spendingplanid="+id,
  "mywindow","status=0,width=900,height=550, left=220,top=220");
}


</script>

        <cc2:EditCaseSubNav ID="EditCaseSubNav" runat="server" InvalidTabs="none" ShowCaseNotes="True" ShowEmployeeInfo="True" ShowLegalGuardianInfo="True" ShowMedicalCareProvider="True" ShowParticipantRepInfo="True" ShowPersonalInfo="True" UseTable="true" />
        <cc2:FinancialSubNav  ID="FinancialSubName" runat="server" InvalidTabs="none" ShowBudgetInfo="True" ShowSubmitSpendingPlan="True" ShowViewSpendingPlan="True" ShowGetSpendingPlan="True" ShowViewMonthlyStatement="True" ShowSubmitMonthlyStatement="True" ShowGetMonthlyStatement="True" ShowHistory="True" ShowAffirmations="true" UseTable="true" Width="862px" style="left: 229px; top: 16px" />

    <a id="pageContent">
<uc2:PopupMessage ID="PopupMessage1" runat="server" />
</a>
   <cc1:Accordion ID="SpendingPlanAccordion" runat="server" SelectedIndex="0"
            HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected"
            ContentCssClass="accordionContent" FadeTransitions="false" FramesPerSecond="40" 
            TransitionDuration="250" AutoSize="None" RequireOpenedPane="true" SuppressHeaderPostbacks="true">
   <Panes>
    <cc1:AccordionPane ID="ViewListOfPlans" runat="server" CssClass="accordionContent">
    <Header><asp:Label ID="SpendingPlanListLabel" runat="server" Text="List of Plans for"></asp:Label></Header>
    <Content>
         <asp:GridView ID="SpendingPlansGridView" runat="server" CssClass="gridOffset" Width="825px" AutoGenerateColumns="False" PageSize="5" AllowPaging="true" DataKeyNames="SpendingPlanId, SpendingPlanStatusId" CellPadding="5" BorderColor="Gray" BorderStyle="Solid" GridLines="Vertical" EmptyDataText="No spending plans have been posted for this participant." AllowSorting="True">
            <HeaderStyle  CssClass="headerStyle" BackColor="#949FB1" BorderColor="Gray" VerticalAlign="Top" />
            <RowStyle CssClass="columnStyle" BackColor="White" />
            <Columns>
                <asp:TemplateField HeaderText="Active">
                  <ItemStyle HorizontalAlign="center" />
                   <ItemTemplate>
                <asp:Image ID="IsActiveImage" runat="server" ImageUrl='<%#GetActiveImage(Eval("IsCurrentlyActive")) %>' />
                </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="DateCreated" ReadOnly="true" HeaderText="Submitted" SortExpression="DateCreated" DataFormatString="{0:MM/dd/yyyy}" />
                <asp:TemplateField HeaderText="Start Date" SortExpression="StartDate">
                    <ItemTemplate>
                        <%#Eval("StartDate", "{0:MM/dd/yyyy}")%>
                    </ItemTemplate>
                     <EditItemTemplate>
                    <asp:TextBox ID="EditStartDateTextBox" Columns="12" Width="75" runat="server" Text=' <%#Eval("StartDate", "{0:MM/dd/yyyy}")%>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                     <asp:TemplateField HeaderText="End Date" SortExpression="EndDate">
                    <ItemTemplate>
                        <%#Eval("EndDateString")%>
                    </ItemTemplate>
                    <EditItemTemplate>
                    <asp:TextBox ID="EditEndDateTextBox" Columns="12" Width="75" runat="server" Text=' <%#Eval("EndDateString")%>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                   <asp:TemplateField HeaderText="Status" SortExpression="Description">
                    <ItemTemplate>
                       <span style='color:<%#GetStatusColor(Eval("SpendingPlanStatusId")) %>;'>  <%#Eval("Status")%></span>
                    </ItemTemplate>
                    <EditItemTemplate>
                    <asp:DropDownList ID="EditStatusDropDownList" DataTextField="Description" DataValueField="SpendingPlanStatusId" runat="server"></asp:DropDownList>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="SubmittedBy" ReadOnly="true" HeaderText="Submitted By" SortExpression="SubmittedBy" />
                
                   <asp:TemplateField HeaderText="Comments" SortExpression="Comments">
                    <ItemTemplate>
                    <a href="javascript:openCommentsWindow('<%#Eval("SpendingPlanId")%>');" title='<%#Replace(Eval("Comments"),"'","&rsquo;") %>'>Comments</a>
                </ItemTemplate>
                   </asp:TemplateField>
                   <asp:BoundField DataField="Version" ReadOnly="true" HeaderText="Version" SortExpression="Version" />
                   <asp:CommandField ShowEditButton="true" EditText="Edit" UpdateText="Save" CancelText="Cancel" HeaderText="Action" />
                   <asp:TemplateField HeaderText="View">
                    <ItemTemplate><asp:LinkButton runat="server" CommandName="View" ToolTip="Click to view spending plan details." Text="View" CommandArgument='<%#Eval("SpendingPlanId")%>'></asp:LinkButton></ItemTemplate>
                   </asp:TemplateField>
            </Columns>
            <AlternatingRowStyle BackColor="#E8ECF4" />
            <EmptyDataRowStyle CssClass="label" HorizontalAlign="Center" />
        </asp:GridView>
        <asp:Panel ID="SelectDenialReasonPanel" runat="server" Visible="false">
      <asp:Label ID="DenialReasonLabel" runat="server" AssociatedControlID="DenialReasonDropDownList">Please select Denial Reason:</asp:Label>
      <asp:DropDownList ID="DenialReasonDropDownList2" runat="server"></asp:DropDownList>
</asp:Panel>

<asp:Panel ID="UploadConfirmPanel" runat="server" Visible="false">
        <asp:Button ID="ConfirmUploadButton" runat="server" Text="Confirm" />
        <asp:Button ID="CancelUploadButton" runat="server" Text="Cancel" /></asp:Panel>
    </Content>
    </cc1:AccordionPane>
    <cc1:AccordionPane ID="DetailsPane" runat="server" CssClass="accordionContent">
    <Header>Spending Plan Details</Header>
    <Content>
    <div style="width:918px;" runat="server" id="maindiv">
    <table style="width:915px; text-align:center;" class="labelSmallNoWidth">
    <tr><td>Current Status: <asp:Label runat="server" ID="CurrentStatusLabel" /></td>
    <td>Start Date: <asp:Label runat="server" ID="StartDateLabel" AssociatedControlID="StartDateTextBox" /><asp:TextBox ID="StartDateTextBox" runat="server" Visible="false"></asp:TextBox></td>
    <td align="right"><asp:Label runat="server" ID="ApprovedDateOfPlanDescriptionLabel" AssociatedControlID="ApprovedDateOfPlanTextBox">Approved Date of Plan:</asp:Label> <asp:Label runat="server" ID="ApprovedDateOfPlanLabel" /><asp:TextBox ID="ApprovedDateOfPlanTextBox" runat="server" Visible="false"></asp:TextBox></td>
    <td>Budget Effective Date: <asp:Label runat="server" ID="EffectiveDatesLabel" /></td><td align="right">Total Budget Amount for Period:&nbsp;<asp:Label runat="server" ID="BudgetAmount" /></td>
    </tr>
    <tr>
    <td colspan="8" align="center"><asp:Label runat="server" ID="ErrorLabel" Visible="false" Font-Bold="true" ForeColor="Red" Font-Names="Arial, MS Sans Serif, Verdana, Sans-Serif" /></td></tr>
                </table>
            <asp:GridView ID="SpendingPlanDetailsGridView" runat="server" ShowFooter="true" Font-Bold="true" Font-Names="Arial, MS Sans Serif, Verdana, Sans-Serif" CellPadding="5" BorderColor="gray" BorderStyle="solid" Width="875px" Font-Size="small" BorderWidth="1"  AutoGenerateColumns="False">
                <Columns>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <tr style="background-color:#949FB1">
                                <td style="width:5%" ></td>
                                <td style="width:50%" align="center">Category Name</td>
                                <td style="width:50%" align="center">Total Plan per Budget Period</td>
                            </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr>
                                <td style="width:5%" align="right"><asp:Button runat="server" ID="toggleDetails" Text="Details" ToolTip="Click here to view detailed information on this item." /></td>
                                <td style="width:50%" align="left">
                                    <asp:Label ID="DisplayNameLabel" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Label>
                                </td>
                                <td style="width:40%" align="right">
                                    <asp:Label ID="TotalCostLabel" runat="server" Text='<%# String.Format("{0:C}", Eval("TotalCost")) %>'></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <asp:GridView Font-Bold="true" Font-Names="Arial, MS Sans Serif, Verdana, Sans-Serif" CellPadding="5" BorderColor="gray" BorderStyle="solid" Width="875px" Font-Size="small" BorderWidth="1" ID="GridView6" runat="server" AutoGenerateColumns="False">
                                        <Columns>
                                        </Columns>
                                        <AlternatingRowStyle BackColor="#E8ECF4" />
                                    </asp:GridView>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            <tr style="background-color:#949FB1">
                                <td colspan="2" align="right">Balance</td>
                                <td align="right"><asp:Label ID="lblBalance" runat="server"></asp:Label></td>
                            </tr>
                        </FooterTemplate>
                    </asp:TemplateField>
                </Columns>
                <AlternatingRowStyle BackColor="#E8ECF4" />
            </asp:GridView>
            <br />
            <div id="ApproveDiv" style="text-align:center">
               <asp:Button ID="ApproveButton" CommandName="Approve" runat="Server" Text="Approve" Visible="false" />
                <asp:Button ID="RejectButton" CommandName="Reject" runat="Server" Text="Reject" Visible="false" />
                <asp:DropDownList ID="DenialReasonDropDownList" runat="server" Visible="false"></asp:DropDownList>
            </div>
        </div>
    </div>
    
    </Content>
    </cc1:AccordionPane>
    </Panes>
    </cc1:Accordion>
</asp:Content>
